package sui.utils.excel.test;

import java.io.IOException;

import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;

import sui.utils.excel.ReaderExcelGenerateSQL;

public class ExcelToSQL {

//	private static final String BASE_SQL = "UPDATE TCR_CRI_INDI_CLIENT set FCLIENT_SOURCE = ${customer_source}, FCLIENT_SOURCE2 = ${customer_source2}, FCLIENT_SOURCE3 = ${customer_source3}, FOPERATETIME = SYSDATE WHERE FID = ${id};";
	private static final String BASE_SQL1 = "UPDATE t_customer_sensitive s set s.crm = (SELECT com_emp_id FROM t_customer_smp_company_group WHERE com_emp_no = ${crm_id}), s.cca = NULL, s.operate_time = NOW() WHERE customer_code = ${customer_code};";
	private static final String BASE_SQL2 = "UPDATE TCR_CRI_INDI_CLIENT s set s.FCRM = (SELECT com_emp_id FROM smp_employee WHERE com_emp_no = ${crm_id}), s.FCRM_NAME = (SELECT name FROM smp_employee WHERE com_emp_no = ${crm_id}), s.fcca = NULL, s.FCCA_NAME = NULL, s.foperatetime = SYSDATE WHERE fclient_code = ${customer_code};";
	private static final String EXCEL_FILE_PATH_AND_NAME = "F:\\window\\Desktop\\数据删除处理.xlsx";
	private static final String SQL_FIEL_PATH = "F:\\window\\Desktop\\日常运维\\2017-09-07\\";
	
	public static void main(String[] args) throws EncryptedDocumentException, InvalidFormatException, IOException {
//		ReaderExcelGenerateSQL.readerExcelGenerateSQL(EXCEL_FILE_PATH_AND_NAME, BASE_SQL, SQL_FIEL_PATH);
		ReaderExcelGenerateSQL.readerExcelGenerateSQL(EXCEL_FILE_PATH_AND_NAME, BASE_SQL1, SQL_FIEL_PATH);
		ReaderExcelGenerateSQL.readerExcelGenerateSQL(EXCEL_FILE_PATH_AND_NAME, BASE_SQL2, SQL_FIEL_PATH);
	}
}
